package slimeVolleyball;

import javax.swing.*;
import java.awt.event.*;
import java.util.*;

public class SlimeListener implements KeyListener
{
	Slime aSlimeOne;
	Slime aSlimeTwo;
	Set<Integer> keysPressedOne;

	public SlimeListener(SlimeGui bob, Slime aSlimeOne, Slime aSlimeTwo)
	{	
		bob.addKeyListener(this);
		this.aSlimeOne = aSlimeOne;
		this.aSlimeTwo = aSlimeTwo;
	}

	public synchronized void keyPressed(KeyEvent e) 
	{
		aSlimeOne.setKeyPressed(e.getKeyCode());
		aSlimeOne.startTimer();
		aSlimeTwo.setKeyPressed(e.getKeyCode());
		aSlimeTwo.startTimer();
	}

	public synchronized void keyReleased(KeyEvent e) 
	{
		aSlimeOne.removeKeyPressed(e.getKeyCode());
		aSlimeTwo.removeKeyPressed(e.getKeyCode());
	}

	public void keyTyped(KeyEvent e) 
	{
	}


}